import 'package:wanxiang_app/generated/json/base/json_convert_content.dart';
import 'package:wanxiang_app/bean/service_list_entity.dart';

ServiceListEntity $ServiceListEntityFromJson(Map<String, dynamic> json) {
  final ServiceListEntity serviceListEntity = ServiceListEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    serviceListEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    serviceListEntity.msg = msg;
  }
  final List<ServiceListData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<ServiceListData>(e) as ServiceListData)
      .toList();
  if (data != null) {
    serviceListEntity.data = data;
  }
  return serviceListEntity;
}

Map<String, dynamic> $ServiceListEntityToJson(ServiceListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension ServiceListEntityExtension on ServiceListEntity {
  ServiceListEntity copyWith({
    int? code,
    String? msg,
    List<ServiceListData>? data,
  }) {
    return ServiceListEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

ServiceListData $ServiceListDataFromJson(Map<String, dynamic> json) {
  final ServiceListData serviceListData = ServiceListData();
  final int? isRest = jsonConvert.convert<int>(json['is_rest']);
  if (isRest != null) {
    serviceListData.isRest = isRest;
  }
  final String? nickname = jsonConvert.convert<String>(json['nickname']);
  if (nickname != null) {
    serviceListData.nickname = nickname;
  }
  final String? photo = jsonConvert.convert<String>(json['photo']);
  if (photo != null) {
    serviceListData.photo = photo;
  }
  final String? account = jsonConvert.convert<String>(json['account']);
  if (account != null) {
    serviceListData.account = account;
  }
  return serviceListData;
}

Map<String, dynamic> $ServiceListDataToJson(ServiceListData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['is_rest'] = entity.isRest;
  data['nickname'] = entity.nickname;
  data['photo'] = entity.photo;
  data['account'] = entity.account;
  return data;
}

extension ServiceListDataExtension on ServiceListData {
  ServiceListData copyWith({
    int? isRest,
    String? nickname,
    String? photo,
    String? account,
  }) {
    return ServiceListData()
      ..isRest = isRest ?? this.isRest
      ..nickname = nickname ?? this.nickname
      ..photo = photo ?? this.photo
      ..account = account ?? this.account;
  }
}